﻿
------------------------------- USER1 application settings -----------------------------------------
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 1 AND ApplicationId = 1)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(1,1)
END
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 1 AND ApplicationId = 2)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(1,2)
END
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 1 AND ApplicationId = 3)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(1,3)
END

------------------------------- USER2 application settings -----------------------------------------
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 2 AND ApplicationId = 1)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(2,1)
END
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 2 AND ApplicationId = 2)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(2,2)
END
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 2 AND ApplicationId = 3)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(2,3)
END

------------------------------- USER3 application settings -----------------------------------------
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 3 AND ApplicationId = 1)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(3,1)
END
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 3 AND ApplicationId = 2)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(3,2)
END
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 3 AND ApplicationId = 3)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(3,3)
END
------------------------------- USER4 application settings -----------------------------------------
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 4 AND ApplicationId = 1)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(4,1)
END
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 4 AND ApplicationId = 2)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(4,2)
END
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 4 AND ApplicationId = 3)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(4,3)
END

------------------------------- USER5 application settings -----------------------------------------
GO
IF NOT EXISTS (SELECT UserApplicationId FROM UserApplication WHERE UserId = 5 AND ApplicationId = 1)
BEGIN
INSERT INTO UserApplication(UserId,ApplicationId)
     VALUES(5,1)
END

